/*
 * gameNode.fx
 *
 * Created on 22.03.2010, 0:05:37
 */

package javafx191labs.agordeev.game.view;

import javafx.scene.CustomNode;
import javafx.scene.Node;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.input.MouseEvent;

/**
 * @author r4diantq
 */


public class Column extends CustomNode{
    public var posX : Number;
    public var posY : Number;
    public var rect : Rectangle;
    public var isChiken : Boolean;
    public var isBlocked : Boolean;
    public var isExit : Boolean;
    public var isWay : Boolean;
    public var isFree : Boolean = true;
    override protected function create () : Node {
        rect = Rectangle{
            x: posX;
            y: posY;
            width: 35;
            height: 35;
            fill:Color.BLUE;
            stroke:Color.ORANGE;
            strokeWidth: 3;
            onMouseClicked: function(e:MouseEvent){
                if(isFree == true){
                    rect.fill = Color.BLACK;
                    isBlocked = true;
                    isFree = false;

                } else if(isFree == false and isBlocked == true){
                    rect.fill = Color.BLUE;
                    isBlocked = false;
                    isFree = true;
                }
            }
        }
    }
    public function nodeType() : Void{
        if(isExit == true){
            rect.fill = Color.RED;
            isChiken = false;
            isBlocked = false;
            isFree = false;
            isWay = false;
        } else if(isChiken == true){
            rect.fill = Color.GREEN;
            isExit = false;
            isBlocked = false;
            isFree = false;
            isWay = false;
        } else if(isBlocked == true){
            rect.fill = Color.BLACK;
            isExit = false;
            isChiken = false;
            isFree = false;
            isWay = false;
        } else if(isFree == true){
            rect.fill = Color.BLUE;
            isExit = false;
            isChiken = false;
            isBlocked = false;
            isWay = false;
        } else if(isWay == true){
            rect.fill = Color.AQUAMARINE;
            isExit = false;
            isChiken = false;
            isBlocked = false;
            isFree = false;
        }
    }
}
public class Row{
    public var column : Column[];
}


